#import "Cell.h"

@implementation Cell

@synthesize character;
@synthesize image;
@synthesize empty;
@synthesize canMove;
@synthesize canAttack;
@synthesize x;
@synthesize y;

- (id)init {
	if (self == [super init]) {
		self.character = nil;
		self.image = nil;
		self.empty = YES;
		self.canMove = NO;
		self.canAttack = NO;
		self.x = 0;
		self.y = 0;
	}
	
	return self;
}

- (void)encodeWithCoder: (NSCoder *) encoder {
	[encoder encodeObject:self.character forKey:@"character"];
	[encoder encodeBool:self.empty forKey:@"empty"];
	[encoder encodeBool:self.canMove forKey:@"canMove"];
	[encoder encodeBool:self.canAttack forKey:@"canAttack"];
	[encoder encodeInt:self.x forKey:@"x"];
	[encoder encodeInt:self.y forKey:@"y"];
}

- (id)initWithCoder: (NSCoder *) decoder {
	if (self = [super init]) {
		self.character = [decoder decodeObjectForKey:@"character"];
		self.empty = [decoder decodeBoolForKey:@"empty"];
		self.canMove = [decoder decodeBoolForKey:@"canMove"];
		self.canAttack = [decoder decodeBoolForKey:@"canAttack"];
		self.x = [decoder decodeIntForKey:@"x"];
		self.y = [decoder decodeIntForKey:@"y"];		
	}	
	return self;
}

- (void)dealloc {
    [character release];
	[image release];
    [super dealloc];
}

@end
